package com.gl.saasservice.matchUser.controller;

import com.gl.framework.web.response.Result;
import com.gl.saasservice.matchUser.service.MatchUserService;
import com.gl.saasservice.matchUser.vo.MatchUserAuthorVO;
import com.gl.saasservice.matchUser.vo.MatchUserHouseVO;
import com.gl.saasservice.matchUser.vo.MatchUserLockAuthorVO;
import com.gl.saasservice.matchUser.vo.MatchUserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * 承租人库
 */
@Controller
@RequestMapping("/match")
public class MatchUserController {
    @Autowired
    private MatchUserService matchUserService;

    /**
     * 查询列表
     */
    @GetMapping("/list")
    @ResponseBody
    public Result pageslist(@RequestHeader String token, MatchUserVO vo) {
        return matchUserService.findByMatchUserAndCreateTimeDesc(token,vo);
    }

    /**
     * 针对承租人授权信息设置表
     */
    @PostMapping("/save/number")
    @ResponseBody
    public Result saveAuthorNumber(@RequestBody MatchUserAuthorVO vo){
        return matchUserService.saveOrupdateAuthorNumber(vo);
    }


    /**
     * 针对承租人锁授权信息设置表
     */
    @PostMapping("/save/lockNumber")
    @ResponseBody
    public Result saveAuthor_number(@RequestBody MatchUserLockAuthorVO vo){
        return matchUserService.saveAuthorNumber(vo);
    }

    /**
     * 编辑接口
     */
    @PostMapping("/update/nameandphone")
    @ResponseBody
    public Result updateNameAndPhone(@RequestHeader String token,@RequestBody MatchUserVO vo){
        return matchUserService.updateNameAndPhone(token,vo);
    }

    /**
     * 查询承租人房屋详情列表接口
     */
    @GetMapping("/find/detailList")
    @ResponseBody
    public Result findDetail(MatchUserHouseVO vo){
        return matchUserService.findhouseDetailByid(vo);
    }

    /**
     * 查询智能锁列表展示数据接口
     */
    @GetMapping("/lock/list")
    @ResponseBody
    public Result lockpageslist(MatchUserVO vo){
        return matchUserService.lockpageslist(vo);
    }

}
